package 哈希表;

public class Main {

	public static void main(String[] args) {
		String str = "jack";
		int len = str.length();
		int hashCode = 0;
		for (int i = 0; i < len; i++) {
			char c = str.charAt(i);
			hashCode = hashCode * 31 + c;
		}
		
		System.out.println(hashCode);
		// 用提供的方法
		System.out.println(str.hashCode());
	}

}
